<template>
  <div>
    <!-- <h1>day03作业1</h1> -->
    <ChildDog2
      v-for="(item, index) in list"
      :key="index"
      :dogUrl="item.dogImgUrl"
      :dogName="item.dogName"
      @dogclick="dogClick"
    ></ChildDog2>
    <br />
    <div>
      <div>你喜欢的狗如下：</div>
      <div v-for="(item, index) in childdog2" :key="index">{{ item }}</div>
    </div>
  </div>
</template>

<script>
import ChildDog2 from './components/ChildDog2.vue'
export default {
  components: {
    ChildDog2,
  },
  data() {
    return {
      list: [
        {
          dogImgUrl:
            'https://scpic.chinaz.net/files/pic/pic9/202003/zzpic23514.jpg',
          dogName: '博美',
        },
        {
          dogImgUrl:
            'https://scpic.chinaz.net/files/pic/pic9/202003/zzpic23515.jpg',
          dogName: '泰迪',
        },
        {
          dogImgUrl:
            'https://scpic.chinaz.net/files/pic/pic9/202003/zzpic23516.jpg',
          dogName: '金毛',
        },
        {
          dogImgUrl:
            'https://scpic.chinaz.net/files/pic/pic9/202003/zzpic23517.jpg',
          dogName: '哈士奇',
        },
        {
          dogImgUrl:
            'https://scpic.chinaz.net/files/pic/pic9/202003/zzpic23518.jpg',
          dogName: '阿拉斯加',
        },
        {
          dogImgUrl:
            'https://scpic.chinaz.net/files/pic/pic9/202003/zzpic23513.jpg',
          dogName: '萨摩耶',
        },
      ],
      childdog2: [],
    }
  },
  methods: {
    dogClick(child2dog) {
      console.log('子向父传值')
      return this.childdog2.push(child2dog)
    },
  },
}
</script>

<style></style>
